package fms.core;


import org.apache.log4j.Logger;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * <P>FileName: ObjectUtil.java
 *
 * @author GuoXY
 *         <P>CreateTime: 2014-04-04
 *         <P>Description:
 *         <P>Version: v1.0
 *         <P>History:
 *         <p/>
 */
public class ObjectUtil {

    private ObjectUtil() {

    }

    private static Logger log = Logger.getLogger(ObjectUtil.class);

    public static boolean isBlank(String obj) {
        return (null == obj || "".equals(obj));
    }

    public static boolean isBlank(Integer obj) {
        return (null == obj);
    }

    public static boolean isBlank(Date obj) {
        return (null == obj);
    }

    public static boolean isBlank(BigDecimal obj) {
        return (null == obj);
    }

    public static boolean isBlank(Double obj) {
        return (null == obj);
    }

    public static boolean isBlank(Long obj) {
        return (null == obj);
    }


    // 将两个list合并成一个
    public static List<?> combineList(List<?> mainList, List<?> addList) {
        List returnlist = new ArrayList();

        for (int i = 0; i < mainList.size(); i++) {
            returnlist.add(mainList.get(i));
        }
        for (int j = 0; j < addList.size(); j++) {
            returnlist.add(addList.get(j));
        }
        return returnlist;
    }


    // 将对象数组转换成字符串数组
    public static String[] ObjectToStringArray(Object[] objs) {
        String[] strs = new String[objs.length];
        for (int i = 0; i < objs.length; i++) {
            strs[i] = objs[i].toString();
        }
        return strs;
    }
}
